<template>
  <div>
       <van-nav-bar
         left-arrow
        class="app-nav-bar"
        title="事件详情页"
        @click-left="$router.back()"
      />
      <van-cell-group>
        <van-cell title="事件内容:" :value="tableData.qualityContent" />
        <van-cell title="当前状态:">
            <template #default>
                <!-- <span class="custom-title">{{tableData.eventStatus}}</span> -->
                <span style="margin-left:10px" v-if="tableData.eventStatus === '0'">待派发</span>
                <span style="margin-left:10px" v-if="tableData.eventStatus === '1'">处理中</span>
                <span style="margin-left:10px" v-if="tableData.eventStatus === '2'">已处理</span>
                <span style="margin-left:10px" v-if="tableData.eventStatus === '3'">已结束</span>
                <span style="margin-left:10px" v-if="tableData.eventStatus === '4'">驳回</span>
            </template>
        </van-cell>
        <van-cell title="上报位置:" :value="tableData.reportingLocation" />
        <van-cell title="部件:" :value="tableData.partsName" />
        <van-cell title="部件负责人:" :value="tableData.leader" />
        <van-cell title="上报人:" :value="tableData.reportPerson" />
        <van-cell title="上报时间:" :value="tableData.reportTime" />
        <van-cell title="派发类型:" :value="tableData.distributeType" />
        <van-cell title="派发时间:" :value="tableData.distributionTime" />
        <van-cell title="事件描述:" :value="tableData.eventDesc" />
        <van-cell title="处理人:" :value="tableData.handlerPerson" />
        <van-cell title="处理时间:" :value="tableData.handlerTime" />
        <van-cell title="处理时长:" :value="tableData.handlerDuration" />
        <van-cell title="扣分:" :value="tableData.deductPoints" />
        <van-cell title="片区负责人:" :value="tableData.distributePerson" />
        <van-cell title="转单人:" :value="tableData.transferPerson" />
        <van-cell title="转单时间:" :value="tableData.transferTime" />
        <van-cell title="驳回描述:" :value="tableData.rejectDesc" />
        <van-cell title="照片:">
            <template #default>
                <img :src="imgsrcid" alt="">
            </template>
        </van-cell>
        <van-cell title="已处理照片:">
            <template #default>
                <img :src="handlerPhoto" alt="">
            </template>
        </van-cell>
        <van-cell title-class="btn">
            <template #title>
                <van-button plain type="info" @click="confireHandler">确认处理</van-button>
                <van-button plain type="info" @click="transferOrder">转单</van-button>
            </template>
        </van-cell>
      </van-cell-group>
        
  </div>
</template>

<script>
export default {
    name:"eventdetail",
    data(){
        return{
            tableData:[],
            imgsrcid:null,
            handlerPhoto:null
        }
    },
    methods:{
        async select(){
            var {data:res} =await this.$axios({
                url:this.$location.getEventById,
                params:{
                    id:this.$route.params.id
                }
            })
           this.tableData=res.data;
        },
        confireHandler(){
            this.$router.push('/ConfireHandler/'+this.$route.params.id)
        },
        transferOrder(){
            this.$router.push('/transferOrder/'+this.$route.params.id+"/"+this.tableData.districtId)
        }
    },
    created(){
        this.select();
        
        this.imgsrcid=this.$location.getPhoto+'?id='+this.$route.params.id+"&width=100&height=100"
        this.handlerPhoto=this.$location.getHandlerPhoto+'?id='+this.$route.params.id+"&width=100&height=100"
    }
}
</script>

<style lang="less" scoped>
    /deep/ .app-nav-bar{
        background-color: #3296fa;
        .van-nav-bar__title{
            color: #fff;
        }
        .van-icon{
            color: #fff;
        }
    }
    /deep/ .btn button{
        margin: 10px;
    }
</style>